import axios from 'axios';
import cookie from './cookie';

axios.defaults.timeout = 10000;
axios.defaults.withCredentials = true;
axios.interceptors.request.use(function (config) {
    let token = cookie.getItem('TOKEN');
    if (token) {
        config.headers.common.Authorization = token;
    }

    return config;
}, function (error) {
    return Promise.reject(error);
});

export default axios;
